/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package logging.report;

import java.util.Arrays;

/**
 *
 * @author Salm
 */
public class AdminActionRecord extends RecordImpl {
    
    private final AdminAction act;
    private final String[] data;
    
    public AdminActionRecord(AdminAction act, long now, Object... data) {
        super(PGLogCategory.ADMIN, now);
        
        this.act = act;
        this.data = toStrings(Arrays.asList(data), 20);
    }

    @Override
    protected int logSize() {
        return super.logSize() + len(data) + act.toString().length();
    }

    @Override
    protected int logFields() {
        return super.logFields() + data.length + 1;
    }

    @Override
    protected void buildLog(StringBuilder builder) {
        super.buildLog(builder);
        
        logField(builder, act);
        for (String dat : data) {
            logField(builder, dat);
        }
    }
}
